#include "QInhibitorSynapseModel.h"

void QInhibitorSynapseModel::setConstants(void)
{
    hs = 6;
    ds = 1.0/18.0;
    ss = 100;
    ts = 2000;
}
double QInhibitorSynapseModel::dNuOut(double _nuOut)
{
    return (-(1+tanh(ss*(nuIn-hs)))*(1+_nuOut)-_nuOut/ds)*dt/ts;
}
void QInhibitorSynapseModel::rungeNuOut()
{
    double k1,k2,k3,k4;
    k1=k2=k3=k4=0;

    k1 = dNuOut(nuOut);
    k2 = dNuOut(nuOut+k1/2);
    k3 = dNuOut(nuOut+k2/2);
    k4 = dNuOut(nuOut+k3);
    nuOut = nuOut + (k1+2*k2+2*k3+k4)/6;
}

QInhibitorSynapseModel::QInhibitorSynapseModel()
{
    this->setConstants();
    this->setDt(0.1);
    this->setNuIn(0);
    nuOut = 0;
}

double QInhibitorSynapseModel::calculateNu(void)
{
    this->rungeNuOut();
    return nuOut;
}
void QInhibitorSynapseModel::setDt(double _dt)
{
    dt = _dt;
}
void QInhibitorSynapseModel::setNuIn(double _nuIn)
{
    nuIn = _nuIn;
}
void QInhibitorSynapseModel::setTS(double _ts)
{
    ts = _ts;
}
